package com.yewen.http.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * @Classname RequestPageHandler
 * @Description 请求页面处理器
 * @Date 2022/3/22 11:24
 * @Created by TaoVh
 */
@Controller
@RequestMapping("/yewen/pages")
public class RequestPageHandler {

    /**
     * @Description 请求登陆页面
     * @Author Taovh
     * @Date 2022/3/22 15:19
     * @return org.springframework.web.servlet.ModelAndView
     **/
    @GetMapping("/login")
    public ModelAndView login(){
        ModelAndView modelAndView  = new ModelAndView();
        modelAndView.setViewName("login");
        return modelAndView;
    }

    /**
     * @Description 请求主页
     * @Author Taovh
     * @Date 2022/3/22 15:19
     * @return org.springframework.web.servlet.ModelAndView
     **/
    @GetMapping("/home")
    public ModelAndView home(HttpServletRequest request){
        ModelAndView modelAndView  = new ModelAndView();
        modelAndView.addObject("id",request.getParameter("id"));
        modelAndView.setViewName("home");
        return modelAndView;
    }

    /**
     * @Description 请求注册页面
     * @Author Taovh
     * @Date 2022/3/22 15:19
     * @return org.springframework.web.servlet.ModelAndView
     **/
    @GetMapping("/register")
    public ModelAndView register(String name){
        ModelAndView modelAndView  = new ModelAndView();
        modelAndView.setViewName("register");
        return modelAndView;
    }

    /**
     * @Description 请求学校介绍页面
     * @Author Taovh
     * @Date 2022/3/22 15:19
     * @return org.springframework.web.servlet.ModelAndView
     **/
    @GetMapping("/university_intro")
    public ModelAndView universityIntro(String id){
        ModelAndView modelAndView  = new ModelAndView();
        modelAndView.setViewName("university_intro");
        modelAndView.addObject("id");
        return modelAndView;
    }

}
